import resolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'
import json from 'rollup-plugin-json'
import pkg from './package.json'

export default [
  {
    // browser-friend UMD build
    input: 'src/index.js',
    output: {
      name: 'ShpConverter',
      file: pkg.browser,
      format: 'umd',
    },
    plugins: [
      resolve(),
      commonjs(),
      json(),
    ]
  },
  // CommonJS (for Node) and ES module (for bundlers) build.
  {
    input: 'src/index.js',
    external: [
      'd3-dsv',
      'flatbush',
      'iconv-lite',
      'jszip',
      'mproj'
    ],
    output: [
      { file: pkg.main, format: 'cjs' },
      { file: pkg.module, format: 'es'}
    ],
    plugins: [
      resolve(),
      commonjs(),
      json(),
    ]
  }
]